<?php
/* @var $this CallbackController */
/* @var $model Callback */

$this->breadcrumbs=array(
	'Manage Callbacks',
);

$this->menu=array(
	//array('label'=>'List Callback', 'url'=>array('index')),
	//array('label'=>'Create Callback', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#callback-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>Manage Callbacks</h1>

<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>

<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'callback-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		array(
			'name'=>'sr_number',
			'header'=>'C3 SR#',
			'value'=>'$data->sr_number',
			'htmlOptions' => array(
								'style' => 'width:80px;text-align:center;',
							 ),
		),	
		array(
			'name'=>'date',
			'header'=>'Date',
			'value'=>'$data->date',
			'htmlOptions' => array(
								'style' => 'width:50px;text-align:center;',
							 ),
		),	
		array(
			'name'=>'idqshift',
			'header'=>'Q-Shift',
			'value'=>'$data->qshift_relation->name',
			'filter'=>CHtml::listData(Qshift::model()->findAll(array('order'=>'start_time ASC','condition'=>'team_id= '.Yii::app()->user->team_id)),
																		 'idqshift',
																		 'name'
																		 ),				
			'htmlOptions' => array(
								'style' => 'width:70px;text-align:center;',
							 ),
		),	
		array(
			'name'=>'time',
			'header'=>'Time',
			'value'=>'$data->time',
			'htmlOptions' => array(
								'style' => 'width:50px;text-align:center;',
							 ),
		),		
		array(
			'name'=>'isAssigned',
			'header'=>'Is Assigned?',
			'value'=> 'Callback::getYesNoValue($data->isAssigned)',
			'filter' => array('0'=>'No', '1'=>'Yes'),
			'htmlOptions' => array(
								'style' => 'width:60px;text-align:center;',
							 ),
		),		
		array(
			'name'=>'created_by',
			'header'=>'Created By',
			'value'=>'$data->createdBy_relation->username',
			'filter'=>CHtml::listData(User::model()->findAll(array('order'=>'username ASC','condition'=>'team= '.Yii::app()->user->team_id)),
																		 'iduser',
																		 'username'
																		 ),
			'htmlOptions' => array(
								'style' => 'width:70px;text-align:center;',
							 ),
		),		
		array(
			'name'=>'new_owner',
			'header'=>'New Owner',
			'value'=>('$data->new_owner'!=0)? '$data->newOwner_relation->username' : '',
			'filter'=>CHtml::listData(User::model()->findAll(array('order'=>'username ASC','condition'=>'team= '.Yii::app()->user->team_id)),
																		 'iduser',
																		 'username'
																		 ),			
			'htmlOptions' => array(
								'style' => 'width:70px;text-align:center;',
							 ),
		),			
		/*
		'comments',
		'team_id',
		*/
		array(
			'class'=>'CButtonColumn',
		),
	),
)); ?>


